package com.dlc.shop.user.common.task;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.dlc.shop.bean.param.UserManagerParam;
import com.dlc.shop.bean.param.UserManagerReqParam;
import com.dlc.shop.common.util.PageParam;
import com.dlc.shop.service.UserService;

import java.util.List;
import java.util.concurrent.Callable;

/**
 * @author lanhai
 */
public class ListUserExportDataTask implements Callable<List<UserManagerParam>> {

    private final UserService userService;
    private final UserManagerReqParam user;
    private final PageParam<UserManagerParam> pages;

    public ListUserExportDataTask(UserService userService, UserManagerReqParam user, PageParam<UserManagerParam> pages) {
        this.userService = userService;
        this.user = user;
        this.pages = pages;
    }

    @Override
    public List<UserManagerParam> call() throws Exception {
        IPage<UserManagerParam> userPage =  userService.pageUserByMultiShop(pages, user);
        return userPage.getRecords();
    }
}
